﻿<?xml version="1.0" encoding="utf-8"?>
<xsd:schema id="SqlMapperMappingSchema" targetNamespace="http://schemas.microsoft.com/dsltools/SqlMapperMapping" elementFormDefault="qualified" xmlns="http://schemas.microsoft.com/dsltools/SqlMapperMapping" xmlns:core="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:import id="CoreSchema" namespace="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" />
  <!-- Mapping -->
  <xsd:element name="mapping" type="Mapping" substitutionGroup="core:modelElement" />
  <xsd:complexType name="Mapping">
    <xsd:annotation>
      <xsd:documentation>The root in which all other elements are embedded. Appears as a diagram.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElement">
        <xsd:sequence minOccurs="0" maxOccurs="1">
          <!-- Relationship: MappingHasElements -->
          <xsd:element name="elements" minOccurs="0" maxOccurs="1">
            <xsd:annotation>
              <xsd:documentation>Instances of MappingHasElements</xsd:documentation>
            </xsd:annotation>
            <xsd:complexType>
              <xsd:sequence>
                <xsd:choice minOccurs="0" maxOccurs="unbounded" >
                  <xsd:element ref="mappingHasElements">
                    <xsd:annotation>
                      <xsd:documentation>[Relationship deriving from MappingHasElements needs to be serialized in full-form]</xsd:documentation>
                    </xsd:annotation>
                  </xsd:element>
                  <xsd:element ref="entity" >
                    <xsd:annotation>
                      <xsd:documentation>[Target role-player]</xsd:documentation>
                    </xsd:annotation>
                  </xsd:element>
                </xsd:choice>
              </xsd:sequence>
            </xsd:complexType>
          </xsd:element>
        </xsd:sequence>
        <!-- Id -->
        <xsd:attribute name="Id" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Instance Guid of this element, needed because SerializeId is set to true.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
        <!-- dslVersion -->
        <xsd:attribute name="dslVersion" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Version of the model serialized in this file.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- Mapping Moniker -->
  <xsd:element name="mappingMoniker" type="MappingMoniker" substitutionGroup="core:modelElementMoniker" />
  <xsd:complexType name="MappingMoniker">
    <xsd:annotation>
      <xsd:documentation>Moniker for Mapping instance.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElementMoniker">
        <xsd:attribute name="Id" type="xsd:string" >
          <xsd:annotation>
            <xsd:documentation>Attribute to store the moniker string.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- Entity -->
  <xsd:element name="entity" type="Entity" substitutionGroup="core:modelElement" />
  <xsd:complexType name="Entity">
    <xsd:annotation>
      <xsd:documentation>Elements embedded in the model. Appear as boxes on the diagram.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElement">
        <xsd:sequence minOccurs="0" maxOccurs="1">
          <!-- Relationship: EntityReferencesTargets -->
          <xsd:element name="targets" minOccurs="0" maxOccurs="1">
            <xsd:annotation>
              <xsd:documentation>Instances of EntityReferencesTargets</xsd:documentation>
            </xsd:annotation>
            <xsd:complexType>
              <xsd:sequence>
                <xsd:choice minOccurs="0" maxOccurs="unbounded" >
                  <xsd:element ref="entityReferencesTargets">
                    <xsd:annotation>
                      <xsd:documentation>[Relationship deriving from EntityReferencesTargets needs to be serialized in full-form]</xsd:documentation>
                    </xsd:annotation>
                  </xsd:element>
                  <xsd:element ref="entityMoniker" >
                    <xsd:annotation>
                      <xsd:documentation>[Target role-player]</xsd:documentation>
                    </xsd:annotation>
                  </xsd:element>
                </xsd:choice>
              </xsd:sequence>
            </xsd:complexType>
          </xsd:element>
        </xsd:sequence>
        <!-- Id -->
        <xsd:attribute name="Id" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Instance Guid of this element, needed because SerializeId is set to true.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
        <!-- Property: Name -->
        <xsd:attribute name="name" type="xsd:string" use="required" />
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- Entity Moniker -->
  <xsd:element name="entityMoniker" type="EntityMoniker" substitutionGroup="core:modelElementMoniker" />
  <xsd:complexType name="EntityMoniker">
    <xsd:annotation>
      <xsd:documentation>Moniker for Entity instance.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElementMoniker">
        <xsd:attribute name="name" type="xsd:string" >
          <xsd:annotation>
            <xsd:documentation>Attribute to store the moniker string.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- MappingHasElements -->
  <xsd:element name="mappingHasElements" abstract="true" type="MappingHasElements" substitutionGroup="core:modelElement" />
  <xsd:complexType name="MappingHasElements" abstract="true" >
    <xsd:annotation>
      <xsd:documentation>Embedding relationship between the Model and Elements</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElement">
        <xsd:sequence minOccurs="0" maxOccurs="1">
          <!-- Target end Entity -->
          <xsd:element ref="entity" minOccurs="1" maxOccurs="1">
            <xsd:annotation>
              <xsd:documentation>[Target role-player]</xsd:documentation>
            </xsd:annotation>
          </xsd:element>
        </xsd:sequence>
        <!-- Id -->
        <xsd:attribute name="Id" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Instance Guid of this element, needed because SerializeId is set to true.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- MappingHasElements Moniker -->
  <xsd:element name="mappingHasElementsMoniker" type="MappingHasElementsMoniker" substitutionGroup="core:modelElementMoniker" />
  <xsd:complexType name="MappingHasElementsMoniker">
    <xsd:annotation>
      <xsd:documentation>Moniker for MappingHasElements instance.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElementMoniker">
        <xsd:attribute name="Id" type="xsd:string" >
          <xsd:annotation>
            <xsd:documentation>Attribute to store the moniker string.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- EntityReferencesTargets -->
  <xsd:element name="entityReferencesTargets" abstract="true" type="EntityReferencesTargets" substitutionGroup="core:modelElement" />
  <xsd:complexType name="EntityReferencesTargets" abstract="true" >
    <xsd:annotation>
      <xsd:documentation>Reference relationship between Elements.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElement">
        <xsd:sequence minOccurs="0" maxOccurs="1">
          <!-- Target end Entity -->
          <xsd:element ref="entityMoniker" minOccurs="1" maxOccurs="1">
            <xsd:annotation>
              <xsd:documentation>[Target role-player]</xsd:documentation>
            </xsd:annotation>
          </xsd:element>
        </xsd:sequence>
        <!-- Id -->
        <xsd:attribute name="Id" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Instance Guid of this element, needed because SerializeId is set to true.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- EntityReferencesTargets Moniker -->
  <xsd:element name="entityReferencesTargetsMoniker" type="EntityReferencesTargetsMoniker" substitutionGroup="core:modelElementMoniker" />
  <xsd:complexType name="EntityReferencesTargetsMoniker">
    <xsd:annotation>
      <xsd:documentation>Moniker for EntityReferencesTargets instance.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElementMoniker">
        <xsd:attribute name="Id" type="xsd:string" >
          <xsd:annotation>
            <xsd:documentation>Attribute to store the moniker string.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
</xsd:schema>

